package cn.liontalk.microserviceorder.controller;

import cn.liontalk.microserviceorder.entity.Order;
import cn.liontalk.microserviceorder.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Value("${server.port}")
    private int port;

    @GetMapping(value = "/order/{orderId}")
    public Order queryOrderById(@PathVariable("orderId") String orderId) {
        log.info("Hello=========>{},port======>{}",orderId,port);
        return this.orderService.queryOrderById(orderId);
    }

    @GetMapping(value = "/order2/{orderId}")
    public Order queryOrderById2(@PathVariable("orderId") String orderId) {
        return this.orderService.queryOrderById2(orderId);
    }

    @GetMapping(value = "/order3/{orderId}")
    public Order queryOrderById3(@PathVariable("orderId") String orderId) {
        log.info("Hello=========>{},port======>{}",orderId,port);
        return this.orderService.queryOrderById3(orderId);
    }
}
